import FormData from "../../types/FormData";
import WidgetProps from "./WidgetProps";
import {ComponentProps, VueComponent} from "vue3-oop";
import { DynamicWidget } from '../index'

interface IProps {
  formData: FormData,
  widgetProps: WidgetProps
}
export default class WidgetConfig extends VueComponent<IProps> {
  static defaultProps: ComponentProps<IProps> = {
    formData: {},
    widgetProps: {}
  }

  render(){
    const { formData, widgetProps} = this.props;
    const props = { formData, widgetProps };
    // TODO
    return DynamicWidget[widgetProps.widgetType]?.CONF?h(DynamicWidget[widgetProps.widgetType].CONF(),props):null;
  }
}